//
//  TwoViewController.m
//  View
//
//  Created by Mac OS on 16-5-30.
//  Copyright (c) 2016年 lms. All rights reserved.
//

#import "TwoViewController.h"

@interface TwoViewController ()
{
    NSArray *Other;

}

@end

@implementation TwoViewController

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
    
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
    
    //TwoViewController界面的设置；
    
   self.navigationItem.title = @"TwoViewController";
    //1.TwoViewController背景颜色
    self.view.backgroundColor = [UIColor yellowColor];
    
    //设置图标；
    UIButton *button = [UIButton buttonWithType:UIButtonTypeInfoDark];
    //1.按钮图标的文字
    [button setTitle:@"按钮" forState:UIControlStateNormal];
    //2.用Highlighted方法，按下去显示good，还可以用其他方法
    [button setTitle:@"good" forState:UIControlStateHighlighted];
    //3.设置图标文字颜色
    [button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    //4.设置图标图片
    [button setImage:[UIImage imageNamed:@"2"] forState:UIControlStateNormal];
    //1设置图标边框
    button.layer.borderWidth = 1;
    //2将图标边框设置成圆角
    button.layer.cornerRadius = 5;
     //3设置图标背景颜色
    button.layer.borderColor = [UIColor blackColor].CGColor;
    //4位置
    button.frame = CGRectMake(0, 0, 100, 44);
    button.center = CGPointMake(self.view.frame.size.width/2, 100);
    
    [button addTarget:self action:@selector(onClick:) forControlEvents:UIControlEventTouchUpInside];
    [button addTarget:self action:@selector(onClick2:) forControlEvents:UIControlEventTouchDown];

    [self.view addSubview:button];
    
    UILabel *l = [[UILabel alloc] initWithFrame:CGRectMake(16, 150, 100, 44)];
    l.text = @"UILabel测试";
    
    l.textColor = [UIColor redColor];
    l.shadowColor = [UIColor greenColor];
    l.textAlignment = NSTextAlignmentCenter;
    l.tag = 100;
    [self.view addSubview:l];
    
    
    //开关
    //UISwitch *s = [[UISwitch alloc] initWithFrame:CGRectMake(10, 60, 100, 44)];
    UISwitch *s = [[UISwitch alloc] init];
    //s.onTintColor = [UIColor redColor];
    //s.thumbTintColor = [UIColor greenColor];
    //s.tintColor = [UIColor blueColor];
    [self.view addSubview:s];
    [s addTarget:self action:@selector(onSwitch:) forControlEvents:UIControlEventValueChanged];
    
    UISegmentedControl *se = [[UISegmentedControl alloc] initWithFrame:CGRectMake(220, 180, 100, 100)];
    [self.view addSubview:se];
}

- (void)onSwitch:(UISwitch *)s
{

    UILabel *l = (UILabel *)[self.view viewWithTag:100];
    if(s.isOn){
        l.layer.borderWidth = 1;
    }else{
        l.layer.borderWidth = 0;
    
    }


}

-(void)onClick:(UIButton *)sender
{

    sender.backgroundColor = [UIColor whiteColor];

}


-(void)onClick2:(UIButton *)sender
{
    
    sender.backgroundColor = [UIColor brownColor];
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
//#warning Potentially incomplete method implementation.
    // Return the number of sections.
    return 0;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
//#warning Incomplete method implementation.
    // Return the number of rows in the section.
    return 0;
}

/*
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath];
    
    // Configure the cell...
    
    return cell;
}
*/

/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
